public class BubbleSort implements Sorter {
	public SortResult sort(int[] array) {
		int[] a = array;
		int swaps = 0;
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j + 1 < a.length - i; j++) {
				if (a[j] > a[j + 1]) {
					swaps++;
					int t = a[j + 1];
					a[j + 1] = a[j];
					a[j] = t;
				}
			}
		}
		return new SortResult(a, swaps, 0);
	}
}
